local socket = require("socket")
local client = socket.connect("127.0.0.1", 1501)
local count = 0
client:settimeout(0)

local timer = Timer.new(100) 
timer:addEventListener(Event.TIMER, function()
	print(count)
end)

local timer2 = Timer.new(100) 
timer2:addEventListener(Event.TIMER, function()
	s, status, partial = client:receive()
	if partial~=nil then
		count = count + partial:len()
	end
end)

--start the timer
timer:start()
--start the timer
timer2:start()

